package com.beiding.natgo.config;

import com.beiding.natgo.server.Sep;
import com.beiding.natgo.server.SessionManager;
import com.beiding.natgo.server.SessionManagerUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * 服务端配置
 */
@EnableWebSocket
@Configuration
public class ServerConfig {

    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return  new ServerEndpointExporter();
    }

    @Bean
    public SessionManager sessionManager() {
        SessionManager sessionManager = new SessionManager();
        sessionManager.start();
        SessionManagerUtil.setSessionManager(sessionManager);
        return sessionManager;
    }

    @Bean
    public Sep sep() {
        return new Sep();
    }


}
